package 蓝桥._14届.棋盘;

import java.util.*;

public class 二维差分数组 {

    static int N =2005;
    static int[][] diff = new int[N][N];   // 二维差分数组
    static int[][] a = new int[N][N];   // 原数组


    static void insert(int x1, int y1, int x2, int y2, int c){
        diff[x1][y1] +=c;
        diff[x1][y2+1] -=c;
        diff[x2+1][y1] -=c;
        diff[x2+1][y2+1] +=c;
    }

    // 二维差分数组求前缀和就是原数组
    static void pSum(int n){
        // a[i][j] = sum(diff[1,...,i][1,...,j])
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                a[i][j] = a[i-1][j] + a[i][j-1] -a[i-1][j-1] + diff[i][j];
            }
        }
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        int m = scan.nextInt();

        int[][] t = new int[n][n];
        for(int i=0;i<m;i++){
            int x1 = scan.nextInt();
            int y1 = scan.nextInt();
            int x2 = scan.nextInt();
            int y2 = scan.nextInt();
            insert(x1,y1,x2,y2,1);
        }
        pSum(n);
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                System.out.print(a[i][j]%2);
            }
            System.out.print("\n");
        }
        scan.close();
    }
}
